import axios from 'axios';

//1. 创建axios对象
const service = axios.create();

//2. 请求拦截器
service.interceptors.request.use(config => {
  //config.headers['Accept'] = '*/*'
  // config.baseURL = 'https://test-elib.shanghaitech.edu.cn:8088';
  return config;
}, error => {
  console.log(error);
  Promise.reject(error);
});

//3. 响应拦截器
service.interceptors.response.use(response => {
  return response.data;
}, error => {
  console.log(error);
  return Promise.reject(error);
});

export default service;
